#coding=utf-8
from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from config import constants

admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'xiezilou.views.home', name='home'),
    # url(r'^xiezilou/', include('xiezilou.foo.urls')),
    # Uncomment the admin/doc line below to enable admin documentation:
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),

    (r'^$', include('pub.urls')),
    (r'^pub/', include('pub.urls')),
    (r'^job/', include('job.urls')),
    (r'^office/', include('office.urls')),
)

##-------------------静态文件URL处理
urlpatterns += patterns('',
    #使用下面语句即可进行静态文件处理,必须是绝对路径
    (r'^uploads/album/(?P<path>.*)$', 'django.views.static.serve', {'document_root': r'%s\%s' % (constants.PUB_UPLOAD_ROOT, 'album')}),
    (r'^uploads/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': r'%s' % constants.PUB_UPLOAD_ROOT }),
)
urlpatterns += patterns('',
    #使用下面语句即可进行静态文件处理,必须是绝对路径
    (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root':constants.PUB_TEMPLATE_DIR}),
)

#--------------开通的城市URL注册--------------------------------------
from config.constants import locate_host
_cities = locate_host.values() #将locate_host字典的value转换成list
city_urls = []
for c in _cities:
    city_urls.append((r'^%s/$'% c , "reset_locate"))
for x in city_urls:
    urlpatterns += patterns("pub.views", x)